﻿using System;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace IBasicsDal.BaseConstraint
{
    /// <summary>
    /// 基本删除约束
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public partial interface IBaseDal<T>
    {
        /// <summary>
        /// 根据表实体删除指定表行数据(依赖主键删除)
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Delete(T entity);

        /// <summary>
        /// 根据表实体删除指定表行数据(依赖主键删除)
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Task<int> DeleteAsync(T entity);

        /// <summary>
        /// 根据表实体删除指定表行数据(依赖lambda条件删除)
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public int Delete(Expression<Func<T, bool>> expression);

        /// <summary>
        /// 根据表实体删除指定表行数据(依赖lambda条件删除)
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public Task<int> DeleteAsync(Expression<Func<T, bool>> expression);
    }
}
